package cn.com.css.taxInspection.common.job.task;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;

import cn.com.css.taxInspection.common.constants.Constants;
import cn.com.css.taxInspection.gt3.entity.JcAjxxEntity;
import cn.com.css.taxInspection.gt3.entity.JcLsfxMxEntity;
import cn.com.css.taxInspection.gt3.service.JcAjxxService;
import cn.com.css.taxInspection.gt3.service.JcLsfxMxService;
import cn.com.css.taxInspection.gt3.service.JcSjlService;
import cn.com.css.taxInspection.util.TsBqUtils;
import cn.com.css.taxInspection.workflow.constants.WorkflowConstants;
import cn.com.css.taxInspection.workflow.entity.WorkflowInspectionHearEntity;
import cn.com.css.taxInspection.workflow.service.WorkflowInspectionHearService;
import cn.com.css.taxInspection.workrisk.entity.WorkriskControlEntity;
import cn.com.css.taxInspection.workrisk.entity.WorkriskRisk1Entity;
import cn.com.css.taxInspection.workrisk.service.WorkriskControlService;
import cn.com.css.taxInspection.workrisk.service.WorkriskRisk1Service;

/**
 * 立案30天未制作稽查报告案件名单
 *
 * @author shaochangyang
 * @version V1.0
 * @date 2020年3月18日
 */
@Component("risk1Task6")
public class Risk1Task6 {
	private Logger logger = LoggerFactory.getLogger(getClass());
	Date date = new Date();
	
	@Resource
	private WorkflowInspectionHearService workflowInspectionHearService;

	@Resource
	private WorkriskRisk1Service workriskRisk1Service;

	@Resource
	private WorkriskControlService workriskControlService;

	@Resource
	private JcLsfxMxService jcLsfxMxService;
	@Resource
	private JcAjxxService jcAjxxService;
	
	public void run(String params) {
		
		// TODO 排除处理中的
		List<JcLsfxMxEntity> list = jcLsfxMxService.listByRiskName("立案30天未做稽查报告");
		
		for (JcLsfxMxEntity jcLsfxMxEntity : list) {
			String relevance = jcLsfxMxEntity.getRelevance();
			String ts = jcLsfxMxEntity.getTs();
			JcAjxxEntity jcAjxxEntity = jcAjxxService.getByJcajxxuuid(relevance);
			int _i = Integer.parseInt(ts);
			if(_i >= 30){
				String jcry = jcAjxxEntity.getJcry();
				WorkriskControlEntity workriskControlEntity = new WorkriskControlEntity();
				workriskControlEntity.setId(TsBqUtils.getUUID());
				workriskControlEntity.setRelevance(relevance);
				workriskControlEntity.setStateCode("0");
				workriskControlEntity.setStateName("启动");
				workriskControlEntity.setControlType("1");
				workriskControlEntity.setControlName("一级督办");
				// 检查人:检查科科长:纪检委员
				// 1717361227428265985	日志-纪检岗
				// 1708113663597502466	检查-检查科科长岗位
				
				workriskControlEntity.setControlMan1(jcry + ":1717361227428265985:1708113663597502466");
				
				workriskControlEntity.setDetails("立案30天未制作稽查报告");
				workriskControlEntity.setTaxorgcode(jcAjxxEntity.getJcbmDm());
				workriskControlEntity.setDeleted(Constants.DATA_NOT_DELETED);
				workriskControlEntity.setCreateTime(date);
				workriskControlEntity.setCreateId("sysJob");
				workriskControlService.save(workriskControlEntity);
			}
			
			
			
		}
		
		
	}

}
